#include<bits/stdc++.h>
using namespace std;
long long n,a[100050],b[100050],c[100050],dp[100050][5];
int main(){
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	ios::sync_with_stdio();
	cin.tie();
	cout.tie();
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	for(int i=1;i<=n;i++){
		dp[i][1]=max(dp[i-1][2],dp[i-1][3])+a[i];
		dp[i][2]=max(dp[i-1][1],dp[i-1][3])+b[i];
		dp[i][3]=max(dp[i-1][2],dp[i-1][1])+c[i];
	}
	cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));
	return 0;
}
//1 2 2 4 5
//1 2 1 2 3
//1 1 2 4 4 7 7 9 10
//1 1 1 2 2
